package com.example.simple.dialog

import android.annotation.SuppressLint
import android.content.Context
import com.blankj.utilcode.util.ActivityUtils
import com.example.app.R
import com.example.app.base.BaseBottomDialog
import com.example.app.databinding.AppStateViewEmptyBinding
import com.lxj.xpopup.XPopup


/**
 * CreateBy:Joker
 * description：底部弹窗
 */
@SuppressLint("SetTextI18n")
class SimpleBottomDialog(context: Context) : BaseBottomDialog<AppStateViewEmptyBinding>(context) {
    override fun getViewBinding() = AppStateViewEmptyBinding.bind(popupImplView)
    override fun getImplLayoutId() = R.layout.app_state_view_empty

    companion object {
        fun show(onConfirm: (() -> Unit)? = null): SimpleBottomDialog {
            val context = ActivityUtils.getTopActivity()
            val dialog = SimpleBottomDialog(context).apply {
                this.onConfirm = onConfirm
            }

            XPopup.Builder(context)
                .enableDrag(false)
                .isDestroyOnDismiss(true)
                .asCustom(dialog)
                .show()
            return dialog
        }
    }

    private var onConfirm: (() -> Unit)? = null

    override fun onCreate() {
        super.onCreate()
        mViewBinding?.apply {

        }
    }
}